<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增/编辑课程</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container">
    <h1 class="mb-4" th:text="${course == null ? '新增课程' : '编辑课程'}"></h1>
    <form th:action="@{/course/save}" th:object="${course}" method="post">
        <input type="hidden" th:field="*{id}">
        <div class="mb-3">
            <label for="name" class="form-label">课程名称</label>
            <input type="text" class="form-control" id="name" th:field="*{name}" placeholder="请输入课程名称" required>
        </div>
        <div class="mb-3">
            <label for="credit" class="form-label">学分</label>
            <input type="number" class="form-control" id="credit" th:field="*{credit}" placeholder="请输入学分" required>
        </div>
        <div class="mb-3">
            <label for="teacherName" class="form-label">教师名称</label>
            <input type="text" class="form-control" id="teacherName" th:field="*{teacherName}" placeholder="请输入教师名称" required>
        </div>
        <button type="submit" class="btn btn-primary">保存</button>
        <a href="#" th:href="@{/course/list}" class="btn btn-secondary">取消</a>
    </form>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
